//-----------------------------------------------------------------------
// <copyright file="HarmonizedCommodityCodeCollection.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
	
using System;
using System.Collections;
using MyFramework;

namespace MIMS.WRS.Entities
{
	/// <summary>
	/// Summary description for HarmonizedCommodityCodeCollection.
	/// </summary>
	public class HarmonizedCommodityCodeCollection:CollectionBase
	{
		public HarmonizedCommodityCode this[ int index ]  
		{
			get  { return( (HarmonizedCommodityCode) List[index] ); }
			set  { List[index] = value;  }
		}

		public int Add( HarmonizedCommodityCode value )  
		{
			return( List.Add( value ) );
		}

		public int IndexOf( HarmonizedCommodityCode value )  
		{
			return( List.IndexOf( value ) );
		}

		public void Insert( int index, HarmonizedCommodityCode value ) 
		{
			List.Insert( index, value );
		}

		public void Remove( HarmonizedCommodityCode value ) 
		{
			List.Remove( value );
		}

		public bool Contains( HarmonizedCommodityCode value ) 
		{
			// If value is not of type HarmonizedCommodityCode, this will return false.
			return( List.Contains( value ) );
		}

		protected override void OnInsert( int index, Object value ) 
		{
			if ( value.GetType() != Type.GetType("MIMS.WRS.Entities.HarmonizedCommodityCode") )
				throw new ArgumentException(SR.ModelValueMustBeOfTypeHarmonizedCommodityCode, "value" );
		}

		protected override void OnRemove( int index, Object value )  
		{
			if ( value.GetType() != Type.GetType("MIMS.WRS.Entities.HarmonizedCommodityCode") )
				throw new ArgumentException(SR.ModelValueMustBeOfTypeHarmonizedCommodityCode, "value" );
		}

		protected override void OnSet( int index, Object oldValue, Object newValue )  
		{
			if ( newValue.GetType() != Type.GetType("MIMS.WRS.Entities.HarmonizedCommodityCode") )
				throw new ArgumentException(SR.ModelValueMustBeOfTypeHarmonizedCommodityCode, "newValue" );
		}

		protected override void OnValidate( Object value )  
		{
			if ( value.GetType() != Type.GetType("MIMS.WRS.Entities.HarmonizedCommodityCode") )
				throw new ArgumentException(SR.ModelValueMustBeOfTypeCurrency);
		}
	}
}
